package Gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;

import Gui.FontActions.MyFontFamilyAction;

public class FontFamilyListener implements ActionListener {
	private FontActions fontActions;
	
	@Override
	public void actionPerformed(ActionEvent e) {		
		if(e.getSource() instanceof JComboBox){
			JComboBox<String> source = (JComboBox<String>) e.getSource();
			MyFontFamilyAction selFamily = 
					getFontActions().new MyFontFamilyAction("name",
							source.getSelectedItem().toString());
			//trigger defined family action
			selFamily.actionPerformed(e);
		}
	}
	
	public FontFamilyListener(FontActions fontActions){
		setFontActions(fontActions);
	}

	public FontActions getFontActions() {
		return fontActions;
	}

	public void setFontActions(FontActions fontActions) {
		this.fontActions = fontActions;
	}

}
